	var nDialogWidth1 = 300;
	var nDialogHeight1 = 400;
	var nLeft1 = (window.screen.availWidth-nDialogWidth1)/2;
	var nTop1 = (window.screen.availHeight-nDialogHeight1)/2;
	var sFeatures1 = "dialogLeft:"+nLeft1+"px;dialogTop:"+nTop1+"px;dialogHeight:"+nDialogHeight1+"px;dialogWidth:"+nDialogWidth1+"px;help:no;status:no";

	var nDialogWidth2 = 800;
	var nDialogHeight2 = 600;
	var nLeft2 = (window.screen.availWidth-nDialogWidth2)/2;
	var nTop2 = (window.screen.availHeight-nDialogHeight2)/2;
	var sFeatures2 = "dialogLeft:"+nLeft2+"px;dialogTop:"+nTop2+"px;dialogHeight:"+nDialogHeight2+"px;dialogWidth:"+nDialogWidth2+"px;help:no;status:no";

//select one dept
function selOneDept(oId,oName){
	var tempStr = eval("document.all."+oId).value;
	var url="/sys/select/get/selectOneDept";
	var returnVal = window.showModalDialog(url,tempStr,sFeatures1);
	if(returnVal != null && "" != returnVal){
		var tempStr = returnVal.split("\|");
		eval("document.all."+oId).value = tempStr[0];
		eval("document.all."+oName).value = tempStr[1];
	}
}

//select multi depts
function selMultiDept(oId,oName){
	var existDeptIds = eval("document.all."+oId).value;
	var url="/sys/select/get/selectMultiDept";
	var returnVal = window.showModalDialog(url,existDeptIds,sFeatures1);
	if(returnVal == null || returnVal == ""){
		eval("document.all."+oId).value = "";
   		eval("document.all."+oName).value = ""; 
	}else{
		var returnDeptIds = "";
		var returnDeptNames = "";
		var tempStr = returnVal.split(",");
		for(var i=0;i<tempStr.length;i++){
			returnDeptIds = returnDeptIds+tempStr[i].split("%")[0]+"|";
			returnDeptNames = returnDeptNames+tempStr[i].split("%")[1]+",";
		}
   		eval("document.all."+oId).value = returnDeptIds;
   		eval("document.all."+oName).value = returnDeptNames.substring(0,returnDeptNames.length-1); 
	}
}

/**
*	多选用户  如果 type=="one"则为单选用户
*	通过userIds选择用户
*	oName		input的名字（该对象的值即为传入值也为输出值），用来存放选择后的UserNames 以"，"分隔。
*	oId 		input的名字（该对象的值即为传入值也为输出值），用来存放选择后的UserIds 以|分隔。
*	type		选择用户的类型 one为单选 其他为多选
*	width		弹出窗口的宽度
*	height		弹出窗口的高度
*	retfunc		窗口关闭后的回调函数
*	弹出窗口
*/
function selUser(data,windowWork){
	var jsonObject = eval("("+data+")");
	var width=800;
	if(jsonObject.width){
		width = jsonObject.width;
	}
	var height=600;
	if(jsonObject.height){
		height = jsonObject.height;
	}
	var oName=jsonObject.oName;
	var oId=jsonObject.oId;
	var type=jsonObject.type;
	var retfunc=jsonObject.retfunc;
	
	var oIds = windowWork.document.getElementById(oId).value;
	var oNames = windowWork.document.getElementById(oName).value;
	if(oNames != null && oNames != "")
		oNames = oNames+",";
	var existStrs = oIds+"$"+oNames.replace(/\,/g,",");
	existStrs = oIds+"$"+oNames.replace(",,",",");
	
	var url = "/sys/select/get/selectMultiUserIndex?existStrs="+existStrs;
	if("one"==type){
		url = "/sys/select/get/selectOneUserIndex?existStrs="+existStrs;
	}
	var params = new Array();
	params[0] = windowWork;
	params[1] = oId;
	params[2] = oName;
	params[3] = retfunc;
	
	opendailog("{src:'"+url+"',title:'选择用户',width:"+width+",height:"+height+",savefunc:'selUserCallBack'}",windowWork,params);
}
function selUserCallBack(iframe,params){
	var retv = iframe.contentWindow.getUsers();
	params[0].document.getElementById(params[1]).value=retv.split("$")[0];
	params[0].document.getElementById(params[2]).value=retv.split("$")[1];
	if(params[3]){
      	params[0].eval(params[3])();
    }
    return "success";
}

/**
*	多选频道  如果 type=="one"则为单选频道
*	通过userIds选择用户
*	oName		input的名字（该对象的值即为传入值也为输出值），用来存放选择后的频道名称 以"，"分隔。
*	oId 		input的名字（该对象的值即为传入值也为输出值），用来存放选择后的频道ID 以|分隔。
*	type		选择用户的类型 one为单选 其他为多选
*	width		弹出窗口的宽度
*	height		弹出窗口的高度
*	retfunc		窗口关闭后的回调函数
*	弹出窗口
*/
function selChannel(data,windowWork){
	var jsonObject = eval("("+data+")");
	var width=800;
	if(jsonObject.width){
		width = jsonObject.width;
	}
	var height=600;
	if(jsonObject.height){
		height = jsonObject.height;
	}
	var oName=jsonObject.oName;
	var oId=jsonObject.oId;
	var type=jsonObject.type;
	var retfunc=jsonObject.retfunc;
	
	var oIds = windowWork.document.getElementById(oId).value;
	var oNames = windowWork.document.getElementById(oName).value;
	if(oNames != null && oNames != "")
		oNames = oNames+",";
	var existStrs = oIds+"$"+oNames.replace(/\,/g,",");
	existStrs = oIds+"$"+oNames.replace(",,",",");
	
	var url = "/sys/select/get/selectChannelIndex?existStrs="+existStrs;
	if("one"==type){
		url = "/sys/select/get/selectChannelIndex?existStrs="+existStrs;
	}
	var params = new Array();
	params[0] = windowWork;
	params[1] = oId;
	params[2] = oName;
	params[3] = retfunc;
	
	opendailog("{src:'"+url+"',title:'选择频道',width:"+width+",height:"+height+",savefunc:'selChannelCallBack'}",windowWork,params);
}

function selChannelCallBack(iframe,params){
	var retv = iframe.contentWindow.getChannels();
	params[0].document.getElementById(params[1]).value=retv.split("$")[0];
	params[0].document.getElementById(params[2]).value=retv.split("$")[1];
	if(params[3]){
      	params[0].eval(params[3])();
    }
    return "success";
}


//select multi user for All
function selMultiUserForAll(oId,oName){
	var userIds = eval("document.all."+oId).value;
	var userNames = eval("document.all."+oName).value;
	if(userNames != null && userNames != "")
		userNames = userNames+"|";
	var existUserStrs = userIds+"$"+userNames.replace(/\,/g,"|");
	var url="/sys/select/get/selectMultiUserForAllIndex";
	var returnVal = window.showModalDialog(url,existUserStrs,sFeatures2);
	if(returnVal == null || returnVal == "")
		return false;
	if(returnVal == "$"){
		eval("document.all."+oId).value = "";
		eval("document.all."+oName).value = ""; 
	}else{
 		var returnUserIds = returnVal.split("$")[0];
 		var returnUserNames = returnVal.split("$")[1];
 		eval("document.all."+oId).value = returnUserIds;
 		eval("document.all."+oName).value = returnUserNames.substring(0,returnUserNames.length-1).replace(/\|/g,","); 
	}
}

//select multi role
function selMultiRole(oId,oName){
	var roleIds = eval("document.all."+oId).value;
	var roleNames = eval("document.all."+oName).value;
	if(roleNames != null && roleNames != "")
		roleNames = roleNames+"|";
	var existRoleStrs = roleIds+"$"+roleNames.replace(/\,/g,"|");
	var url="/sys/select/get/selectMultiRoleIndex";
	var returnVal = window.showModalDialog(url,existRoleStrs,sFeatures2);
	if(returnVal == null || returnVal == "")
		return false;
	if(returnVal == "$"){
		eval("document.all."+oId).value = "";
		eval("document.all."+oName).value = ""; 
	}else{
 		var returnRoleIds = returnVal.split("$")[0];
 		var returnRoleNames = returnVal.split("$")[1];
 		eval("document.all."+oId).value = returnRoleIds;
 		eval("document.all."+oName).value = returnRoleNames.substring(0,returnRoleNames.length-1).replace(/\|/g,","); 
	}
}

//select multi module
function selMultiModule(oId,oName){
	var roleIds = eval("document.all."+oId).value;
	var roleNames = eval("document.all."+oName).value;
	if(roleNames != null && roleNames != "")
		roleNames = roleNames+"|";
	var existRoleStrs = roleIds+"$"+roleNames.replace(/\,/g,"|");
	var url="/sys/select/get/selectMultiModuleIndex";
	var returnVal = window.showModalDialog(url,existRoleStrs,sFeatures2);
	if(returnVal == null || returnVal == "")
		return false;
	if(returnVal == "$"){
		eval("document.all."+oId).value = "";
		eval("document.all."+oName).value = ""; 
	}else{
 		var returnRoleIds = returnVal.split("$")[0];
 		var returnRoleNames = returnVal.split("$")[1];
 		eval("document.all."+oId).value = returnRoleIds;
 		eval("document.all."+oName).value = returnRoleNames.substring(0,returnRoleNames.length-1).replace(/\|/g,","); 
	}
}

//select multi position
function selMultiPosition(oId,oName){
	var positionIds = eval("document.all."+oId).value;
	var positionNames = eval("document.all."+oName).value;
	if(positionNames != null && positionNames != "")
		positionNames = positionNames+"|";
	var existPositionStrs = positionIds+"$"+positionNames.replace(/\,/g,"|");
	var url="/sys/select/get/selectMultiPositionIndex";
	var returnVal = window.showModalDialog(url,existPositionStrs,sFeatures2);
	if(returnVal == null || returnVal == "")
		return false;
	if(returnVal == "$"){
		eval("document.all."+oId).value = "";
		eval("document.all."+oName).value = ""; 
	}else{
 		var returnPositionIds = returnVal.split("$")[0];
 		var returnPositionNames = returnVal.split("$")[1];
 		eval("document.all."+oId).value = returnPositionIds;
 		eval("document.all."+oName).value = returnPositionNames.substring(0,returnPositionNames.length-1).replace(/\|/g,","); 
	}
}


//select one position
function selOnePosition(oId,oName){
	var userId = eval("document.all."+oId).value;
	var userName = eval("document.all."+oName).value;
	var existUserStr = userId+"|"+userName;
	var url="/sys/select/get/selectOnePositionIndex";
	var returnVal = window.showModalDialog(url,existUserStr,sFeatures2);
	if(returnVal != null && "" != returnVal){
		if(returnVal == "|"){
			eval("document.all."+oId).value = "";
			eval("document.all."+oName).value = ""; 
		}else{
			var returnUserId = returnVal.split("\|")[0];
			var returnUserName = returnVal.split("\|")[1];
			eval("document.all."+oId).value = returnUserId;
			eval("document.all."+oName).value = returnUserName; 
		}
	}
}

//select multi channel
function selMultiChannel1(oId,oName){
	var channelIds = eval("document.all."+oId).value;
	var channelNames = eval("document.all."+oName).value;
	if(channelNames != null && channelNames != "")
		channelNames = channelNames+"|";
	var existChannelStrs = channelIds+"$"+channelNames.replace(/\,/g,"|");
	var url="/sys/select/get/selectChannelIndex";
	var returnVal = window.showModalDialog(url,existChannelStrs,sFeatures2);
	if(returnVal == null || returnVal == "")
		return false;
	if(returnVal == "$"){
		eval("document.all."+oId).value = "";
		eval("document.all."+oName).value = ""; 
	}else{
 		var returnChannelIds = returnVal.split("$")[0];
 		var returnChannelNames = returnVal.split("$")[1];
 		eval("document.all."+oId).value = returnChannelIds;
 		eval("document.all."+oName).value = returnChannelNames.substring(0,returnChannelNames.length-1).replace(/\|/g,","); 
	}
}

